<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="~{common/header :: commonHead}">
    <title>楼层详情</title>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 th:text="${null == editable ? '新增规则' : '编辑规则'}"></h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="row form-body form-horizontal m-t" method="post" th:action="${null == editable ? '/sign_in_rule/add' : '/sign_in_rule/edit'}">
                        <input name="id" th:value="${editable?.id}" style="display: none">
                        <div class="col-md-12 droppable sortable ui-droppable ui-sortable">
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">每日奖励积分数：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="integralPoint" class="form-control"  required="required" th:value="${editable?.integralPoint }" placeholder="请输入每日奖励积分数">
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">第一次连续签到天数：</label>
                                <div class="col-sm-6">
                                    <input  type="text" name="consecutiveDay" class="form-control" th:value="${editable?.consecutiveDay }"  required="required" placeholder="请输入第一次连续签到天数">
                                </div>
                            </div>

                            <div  class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label"><span style="color: red;">* </span>第一次连续签到奖励类型：</label>
                                <div class="col-sm-6">
                                    <select class="form-control" id="usetimetype-selector" name="rewardType"
                                            required="required">
                                        <option value="">请选择</option>
                                        <option th:selected="${editable?.rewardType == 1}" value="1">优惠券</option>
                                        <option th:selected="${editable?.rewardType == 0}" value="0">积分</option>

                                    </select>
                                </div>

                            </div>


                            <div  class="form-group draggable ui-draggable dropped"
                                 th:style="${'position: static; display:' + (editable?.rewardType == 1 ? 'block' : 'none')}"
                                 id="total-input-hour">
                                <label class="col-sm-3 control-label"><span style="color: red;">* </span>请选择优惠券：</label>
                                <div class="col-sm-6">
                                    <div class="col-sm-6" id="coupon-selector">
                                        <select  name="couponId"
                                                 data-placeholder="请选择赠送优惠券..."
                                                 onchange="notice(this.value);"
                                                 class="chosen-select form-control m-b" tabindex="1">
                                            <option value="" th:selected="${editable?.couponId == null}">--请选择
                                            </option>
                                            <option class="id_option" hassubinfo="true"
                                                    th:each="couponDTO:${couponDTOS}"
                                                    th:selected="${editable?.couponId == couponDTO.id}"
                                                    th:value="${couponDTO.id }"
                                                    th:text="${couponDTO.name}"></option>
                                        </select>
                                    </div>
                                </div>
                            </div>


                            <div class="form-group draggable ui-draggable dropped" id="total-input-integral" th:style="${'position: static; display:' + (editable?.rewardType == 0 ? 'block' : 'none')}">
                                <label class="col-sm-3 control-label">第一次连续签到奖励积分数：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="bonusPoints" class="form-control" th:value="${editable?.bonusPoints }" required="required" placeholder="请输入连续签到奖励积分数">
                                </div>
                            </div>


                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">第二次连续签到天数：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="consecutiveSecondDay" class="form-control" th:value="${editable?.consecutiveSecondDay }"  required="required" placeholder="请输入第二次连续签到天数">
                                </div>
                            </div>

                            <div class="form-group draggable ui-draggable dropped"  >
                                <label class="col-sm-3 control-label">第二次连续签到奖励积分数：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="bonusSecondPoints" class="form-control" th:value="${editable?.bonusSecondPoints }" required="required" placeholder="请输入第二次连续签到奖励积分数">
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">是否应用：</label>
                                <div class="col-sm-6">
                                    <label class="radio-inline">
                                        <input type="radio" th:checked="${editable == null ? true : editable.useStatus}" value="1" name="useStatus">是
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" th:checked="${editable == null ? false : !editable.useStatus}" value="0" name="useStatus">否
                                    </label>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>

                            <div class="form-group draggable ui-draggable">
                                <div class="col-sm-12 col-sm-offset-3">
                                    <button class="btn btn-primary" type="submit">保存内容</button>
                                </div>
                            </div>

                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    $("#usetimetype-selector").change(function () {
        let selection = $(this).val();

        if (selection == 1) {
            $("#total-input-hour").css('display', 'block');
            $("#total-input-integral").css('display', 'none');


        }


        if (selection == 0) {
            $("#total-input-hour").css('display', 'none');
            $("#total-input-integral").css('display', 'block');

        }
    });
    $("input[name=endtime]").datepicker({
    });
</script>
</body>
</html>